package com.mobi.Survey;

import android.graphics.Bitmap;
import android.widget.ImageView;

import com.mobi.Survey.controller.Singleton;

/**
 * 
 * <p>
 * <b>Author:</b> Yahya Arshad
 * <p>
 * <b>Company:</b> Mobi Media Soft
 * <p>
 * <b> Website:</b> www.mobimediasoft.com
 * <p>
 * ImageViewScreen.java This class is responsible for displaying Product image
 * if Survey Detail type is single screen Product image will be displayed in
 * this screen upon click of image button
 * <p>
 */
public class ImageViewScreen extends AbstractScreen {

	private ImageView ivProduct;

	protected void onCreate(android.os.Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		Bitmap b = Singleton.getInstance().getBitmapProduct();
		if (b == null) {
			// If Bitmap is null we will display no preview image from app
			// resource
			ivProduct.setImageResource(R.drawable.nopreview);
		} else
			ivProduct.setImageBitmap(b);
		b = null;
	}

	@Override
	protected void initUiVars() {
		ivProduct = (ImageView) findViewById(R.id.imgProduct);

	}

	@Override
	protected int getLayoutId() {
		// TODO Auto-generated method stub
		return LayoutIds.IMAGE_VIEW_SCREEN;
	}

	@Override
	protected void onRelease() {
		Singleton.getInstance().setBitmapProduct(null);
		ivProduct = null;
	}

}
